package com.riant.day08;

/**
 * @Classname Demo05
 * @Description TODO
 * @Date 2021/3/24 11:18
 * @Created by 张斌
 */
public class Demo05 {
    public static void main(String[] args) {
        MyYield myYield=new MyYield();
        new Thread(myYield,"a").run();
        new Thread(myYield,"b").start();
    }
}
class MyYield implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() +"线程开始执行");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() +"线程停止执行");
    }
}